home *** CD-ROM | disk | FTP | other *** search
-
- #include <MacTypes.h>
-
- typedef struct {
- // no ethernet header; please remove it first.
- // IP Header:
- UInt8 versionAndIHL;
- UInt8 typeOfService;
- UInt16 totalLength;
- UInt32 ip1;
- UInt8 timeToLive;
- UInt8 protocol;
- UInt16 headerChecksum;
- UInt32 sourceIP;
- UInt32 destIP;
-
- // udp header
- UInt16 srcPort;
- UInt16 dstPort;
- UInt16 messageLength;
- UInt16 checksum;
-
- // data
- UInt8 data[36]; // optional data
-
- } Packet;
-
- // Generic message descriptor
- struct msg_descriptor {
- UInt8* data; // pointer to buffer containing message
- UInt32 size; // size of message in buffer
- UInt16 offset; // offset to next item in message
- };
- typedef struct msg_descriptor msg_descriptor_t;
-
- #define kMaxResponseLen 1460
- // DNS request (collect DNS message information)
- struct dns_request {
- msg_descriptor_t md;
- UInt16 remotePort;
- UInt32 remoteAddr;
- // data buffer
- UInt8 buf[kMaxResponseLen];
- };
- typedef struct dns_request dns_request_t;
-
-
- OSErr createStash(void);
- void destroyStash(void);
-
- void ConsumePacket( Packet *packet, UInt32 inSize );
- int InitializeResponses();
- void CleanupResponses();
- Boolean GetDName(msg_descriptor_t* md, Str255 outStr);
-